from django.forms import ModelForm

from xadmin.models import Part


class PartForm(ModelForm):
    class Meta:
        model = Part
        exclude = ('site',)

    def __init__(self, *args, **kwargs):
        super(PartForm, self).__init__(*args, **kwargs)

        for field_name in self.fields:
            field = self.fields[field_name]
            field.widget.attrs.update({'class': 'layui-input'})
